package other;

/**
 * Created by Administrator on 2018/4/28.
 */
public class QuickSortPractice {
    public static void QuickSortPractice1(int arr[], int low, int high){
        int start = low;
        int end = high;
        int key = arr[low];

        while(start<end){
            while(start<end && arr[end]>=key){
                end--;
            }
            if(arr[end]<key){
                int tmp = arr[end];
                arr[end] = key;
                arr[start] = tmp;
            }



            while(start<end && arr[start]<=key){
                start++;
            }
            if(arr[start]>key){
                int tmp = arr[start];
                arr[start] = key;
                arr[end] = tmp;
            }
        }

        if(low<start) QuickSortPractice1(arr,low,start-1);
        if(end<high) QuickSortPractice1(arr,end+1,high);

    }
}
